<template>
	<view class="login">
		<view class="login-inputs">
			<view class="title">
				<image src="../../static/img/logo.png" mode="widthFix"></image>
			</view>
			<input type="text" v-model="loginName" placeholder="请输入您的账号"/>
			<input type="password" v-model="passWord" placeholder="请输入您的密码"/>
			<button type="default" @click="checKLogin">登  录</button>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				loginName:'',
				passWord:''
			}
		},
		methods:{
			checKLogin(){
				if(!this.loginName){
					this.common.toast('none','请输入您的账号');
				}else if(!this.passWord){
					this.common.toast('none','请输入您的密码');
				}else{
					let data = {
						UserName:this.loginName,
						Password:this.passWord
					}
					this.$api.UserApi(data).then(res=>{
						if(res.StatusCode == 200){
							this.common.setStore('UserId',res.Data.UserID)
							uni.navigateTo({
								url:'/pages/index/index'
							})
						}else{
							this.common.toast('none',res.Message)
							}
					})
				}
			}
		}
	}
</script>

<style>
	.login-inputs{
	}
	.title{
		color: #0196FD;
		font-size: 50rpx;
		text-align: center;
		padding: 200rpx 0 100rpx 0;
	}
	.title image{
		width: 240rpx;
		height: 240rpx;
	}
	.login-inputs input{
		height: 80rpx;
		line-height: 80rpx;
		border: 1rpx solid #bbb;
		margin: 40rpx;
		width: auto;
		border-radius: 20rpx;
		padding: 0 20rpx;
	}
	.login-inputs button{
		background: #0196FD;
		color: #fff;
		margin: 80rpx 40rpx;
	}
</style>
